package com.soso.base.google.cron.schedule;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ScheduleRuleExecute implements ScheduleRuleChain{
	
	private List<ScheduleRule> listRules=new ArrayList<ScheduleRule>();
	private Iterator<ScheduleRule> itRules=null;
	public ScheduleRuleExecute(){
		listRules.add(new ScheduleRuleA());
		listRules.add(new ScheduleRuleB());
		listRules.add(new ScheduleRuleC());
		itRules=listRules.iterator();
	}
	
	public boolean execute(ScheduleBean scheduleBean){
		if(itRules==null||!itRules.hasNext()){
			return false;
		}
		ScheduleRule scheduleRule=itRules.next();
		return scheduleRule.execute(scheduleBean, this);
		
	}
}
